// 店铺

import type R from '@/types/conduit/R'
import type { AddressBook } from '@/types/entity/AddressBook'
import type { AddressBookResponse } from '@/types/response/address-book'
import request from '@/utils/request'
export const userAddressList = (): Promise<R<AddressBookResponse[]>> =>
  request({
    url: `/user/address-book/user-address-list`,
    method: 'GET'
  })
export const preferredAddressList = (shopId: number): Promise<R<AddressBookResponse[]>> =>
  request({
    url: `/user/address-book/preferred-address-list/${shopId}`,
    method: 'GET'
  })
export const preferredAddress = (shopId: number): Promise<R<AddressBookResponse>> =>
  request({
    url: `/user/address-book/preferred-address/${shopId}`,
    method: 'GET'
  })
export const save = (addressBook: AddressBook): Promise<R<null>> =>
  request({
    url: `/user/address-book/save`,
    method: 'POST',
    data: addressBook
  })

export const deleteItem = (addressBookId: number): Promise<R<null>> =>
  request({
    url: `/user/address-book/delete/${addressBookId}`,
    method: 'DELETE'
  })
